home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / SAT 2.4.0 / SAT / Add-ons / Graphic effects / Headers / ProgressBar.h < prev    next >
Encoding:
Text File  |  1997-03-01  |  2.8 KB  |  63 lines  |  [TEXT/KAHL]

  1. // ProgressBar
  2.  
  3. /*Adaptive progress bar unit*/
  4. /*by Ingemar Ragnemalm 1995*/
  5.  
  6. /*This unit draws a progress bar (for giving the user visual feedback during a long*/
  7. /*modal operation) in the current port. It works in color if available.*/
  8.  
  9. /*The difference between this and other progress bars is that this one is ADAPTIVE,*/
  10. /*giving accurate time indications rather than the number of operations or some*/
  11. /*arbitrary length.*/
  12.  
  13. /*You initialize the bar with InitProgressBar, which gives you a pointer to it data.*/
  14. /*Call AdvanceProgressBar repeatedly during your lengthy operation. Note that you*/
  15. /*do NOT tell how far it should move each time. AdvanceProgressBar will calculate*/
  16. /*that for you from the current time. When your lengthy operation is finished, call*/
  17. /*FinishProgressBar. It will dispose of the pointer and store the final time in the*/
  18. /*preference folder.*/
  19.  
  20. /*The first time you run a progress bar, you get a "barber pole" bar, indicating that*/
  21. /*the expected time is unknown. After that, the time elapsed will be stored, so*/
  22. /*later progress bars will be accurate. The progress bar is shown if the resource*/
  23. /*with the expected time did not exist.*/
  24.  
  25. /*Notes:*/
  26. /*You must provide the resource fork to your OPEN preference file for storing*/
  27. /*the total time.*/
  28. /*If you use several different progress bars, you should use different resID, so that*/
  29. /*they can store different times.*/
  30.  
  31.  
  32. /*
  33. InitProgressBar: Sets up a progress bar and returns a pointer to it.
  34. Parameters:
  35.     prefFile:        File number of an open resource file in which to store preferences.
  36.     resID:        Resource number for the resource in which to save. You should use a different number
  37.                 for every progress bar your program uses
  38.     bounds:        The rectangle in which to draw (local coordinates in the current port).
  39.     colors:        Colors to draw with. Use nil for default colors.
  40.  
  41. ProgressBarColor and ProgressBarColorsRGB: Sets up a color record.
  42.  
  43. AdvanceProgressBar:    Updates the progress bar. The pointer to the progress bar is the only
  44.                             parameter.
  45.  
  46. FinishProgressBar:        Dispose the progress bar. It fills the progress bar to indicate that the
  47.                             operation is completed, but does NOT erase it. The pointer to the
  48.                             progress bar is the only parameter.
  49. */
  50.  
  51.  
  52. typedef Ptr ProgressBarColorPtr;
  53. typedef Ptr ProgressBarPtr;
  54.  
  55. pascal ProgressBarPtr InitProgressBar(short prefFile, short resID, Rect bounds, ProgressBarColorPtr colors);
  56. pascal ProgressBarColorPtr ProgressBarColors(short frameRed, short frameGreen, short frameBlue,
  57.                                             short backRed, short backGreen, short backBlue,
  58.                                             short foreRed, short foreGreen, short foreBlue);
  59. pascal ProgressBarColorPtr ProgressBarColorsRGB(RGBColor frame, RGBColor back, RGBColor fore);
  60. pascal void AdvanceProgressBar(ProgressBarPtr thePB);
  61. pascal void FinishProgressBar(ProgressBarPtr thePB);
  62.  
  63.